Fix clone destination initialization - #4236
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 32dbcbc. Configure here.
| ); | ||
| const encodedName = withoutDotGitDirectory | ||
| .slice(lastSeparatorIndex + 1) | ||
| .replace(/\.(?:git|bundle)$/i, ""); |
There was a problem hiding this comment.
Colon breaks checkout name inference
Low Severity
inferGitCloneDirectoryName treats the last : in the string like a path separator when picking the final segment. SCP remotes only use the first colon after the host; extra colons in the repo path (without /) and local paths whose final component contains : can yield a shorter wrong default checkout name in getCloneDestinationInitialQuery.
Reviewed by Cursor Bugbot for commit 32dbcbc. Configure here.
ApprovabilityVerdict: Approved This PR adds a utility function to infer repository names from git URLs and improves the default clone destination path suggestions. Changes are well-tested, additive, and only affect UI default values without impacting actual clone operations. The open review comment addresses a low-severity edge case. You can customize Macroscope's approvability policy. Learn more. |
|
Note 🤖 GPT-5.6 Sol responding on behalf of Theo Closing this PR after an automated pass over open pull requests. Clone destination handling already shipped in #5989. |


Summary
Testing
vp test packages/shared/src/git.test.ts packages/client-runtime/src/operations/projects.test.tsvp test apps/server/src/sourceControl/SourceControlRepositoryService.test.tsvp checkvp run typecheckvp run lint:mobileNote
Low Risk
UX-only default path initialization with shared parsing logic and unit tests; no changes to clone or auth behavior.
Overview
Clone flows on web and mobile now prefill the destination path with the inferred repo folder (e.g.
~/projects/codex) instead of only the add-project base directory.A new shared helper
inferGitCloneDirectoryNameparses HTTPS, SSH/SCP, Azure DevOps, local paths, and.git/.bundlesuffixes;getCloneDestinationInitialQueryappends that name to the configured base path and falls back to the base alone when inference fails. Regression tests cover cross-platform paths and edge cases.Reviewed by Cursor Bugbot for commit 32dbcbc. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix clone destination path to include inferred repository directory name from remote URL
inferGitCloneDirectoryNameinpackages/shared/src/git.tsto extract a checkout directory name from URL-shaped, SCP-style, and local-path remotes, stripping.git/.bundlesuffixes and decoding percent-encoding.getCloneDestinationInitialQueryinpackages/client-runtime/src/operations/projects.tsthat composes the base directory with the inferred directory name to produce a full destination path.AddProjectDestinationScreenand the webOpenCommandPaletteDialogclone flow to usegetCloneDestinationInitialQuery, so the suggested destination now includes the inferred repo name and updates whenremoteUrlchanges.Macroscope summarized 32dbcbc.